#!/usr/bin/env python




##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
    import builtins as builtin
except ImportError:
    import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
from Cheetah.Template import Template
from Cheetah.DummyTransaction import *
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
from Cheetah.CacheRegion import CacheRegion
import Cheetah.Filters as Filters
import Cheetah.ErrorCatchers as ErrorCatchers

##################################################
## MODULE CONSTANTS
VFFSL=valueFromFrameOrSearchList
VFSL=valueFromSearchList
VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.4.4'
__CHEETAH_versionTuple__ = (2, 4, 4, 'development', 0)
__CHEETAH_genTime__ = 1292607154.987565
__CHEETAH_genTimestamp__ = 'Fri Dec 17 14:32:34 2010'
__CHEETAH_src__ = 'plantilla_cuenta.tmpl'
__CHEETAH_srcLastModified__ = 'Fri Dec 17 14:32:33 2010'
__CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'

if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
    raise AssertionError(
      'This template was compiled with Cheetah version'
      ' %s. Templates compiled before version %s must be recompiled.'%(
         __CHEETAH_version__, RequiredCheetahVersion))

##################################################
## CLASSES

class plantilla_cuenta(Template):

    ##################################################
    ## CHEETAH GENERATED METHODS


    def __init__(self, *args, **KWs):

        super(plantilla_cuenta, self).__init__(*args, **KWs)
        if not self._CHEETAH__instanceInitialized:
            cheetahKWArgs = {}
            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
            for k,v in KWs.items():
                if k in allowedKWs: cheetahKWArgs[k] = v
            self._initCheetahInstance(**cheetahKWArgs)
        

    def respond(self, trans=None):



        ## CHEETAH: main method generated for this template
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write(u'''<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
        <title>''')
        _v = VFFSL(SL,"titulo",True) # u'$titulo' on line 5, col 16
        if _v is not None: write(_filter(_v, rawExpr=u'$titulo')) # from line 5, col 16.
        write(u'''</title>
    </head>
    <body>
        <h1>Cuenta Tel&eacute;fono ''')
        _v = VFFSL(SL,"movil",True) # u'$movil' on line 8, col 36
        if _v is not None: write(_filter(_v, rawExpr=u'$movil')) # from line 8, col 36.
        write(u'''</h1>
        <h2>Periodo ''')
        _v = VFFSL(SL,"ano",True) # u'$ano' on line 9, col 21
        if _v is not None: write(_filter(_v, rawExpr=u'$ano')) # from line 9, col 21.
        write(u'''-''')
        _v = VFFSL(SL,"mes",True) # u'$mes' on line 9, col 26
        if _v is not None: write(_filter(_v, rawExpr=u'$mes')) # from line 9, col 26.
        write(u'''</h2>
        <br>
        <h3>Resumen</h3>
        <table style="text-align: left; width: 50%;" border="1" cellpadding="2" cellspacing="2">
            <tbody>
                <tr>
                    <th style="vertical-align: top; text-align: center;">Item<br></th>
                    <th style="vertical-align: top; text-align: center;">Valor<br></th>
                    <th style="vertical-align: top; text-align: center;">Sobrecargo<br></th>
                </tr>
''')
        for item in VFFSL(SL,"resumen",True): # generated from line 19, col 17
            write(u'''                    <tr>
                        <td style="vertical-align: top;">''')
            _v = VFFSL(SL,"item.item",True) # u'$item.item' on line 21, col 58
            if _v is not None: write(_filter(_v, rawExpr=u'$item.item')) # from line 21, col 58.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: right;">''')
            _v = VFFSL(SL,"item.valor",True) # u'$item.valor' on line 22, col 77
            if _v is not None: write(_filter(_v, rawExpr=u'$item.valor')) # from line 22, col 77.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: right;">''')
            _v = VFFSL(SL,"item.sobrecargo",True) # u'$item.sobrecargo' on line 23, col 77
            if _v is not None: write(_filter(_v, rawExpr=u'$item.sobrecargo')) # from line 23, col 77.
            write(u'''</td>
                    </tr>
''')
        write(u'''                <tr>
                    <td style="vertical-align: top; text-align: right;"><span style="font-weight: bold;">NETO</span><br></td>
                    <td style="text-align: right;" colspan="2" vertical-align:="" top;="" text-align:="" right;=""><span style="font-weight: bold;">''')
        _v = VFFSL(SL,"neto",True) # u'$neto' on line 28, col 149
        if _v is not None: write(_filter(_v, rawExpr=u'$neto')) # from line 28, col 149.
        write(u'''</span><br></td>
                </tr>
                <tr>
                    <td style="vertical-align: top; text-align: right;"><span style="font-weight: bold;">IVA</span><br></td>
                    <td style="text-align: right;" colspan="2" vertical-align:="" top;="" text-align:="" right;=""><span style="font-weight: bold;">''')
        _v = VFFSL(SL,"iva",True) # u'$iva' on line 32, col 149
        if _v is not None: write(_filter(_v, rawExpr=u'$iva')) # from line 32, col 149.
        write(u'''</span><br></td>
                </tr>
                <tr>
                    <td style="vertical-align: top; text-align: right;"><span style="font-weight: bold;">TOTAL</span><br></td>
                    <td style="text-align: right;" colspan="2" vertical-align:="" top;="" text-align:="" right;=""><span style="font-weight: bold;">''')
        _v = VFFSL(SL,"total",True) # u'$total' on line 36, col 149
        if _v is not None: write(_filter(_v, rawExpr=u'$total')) # from line 36, col 149.
        write(u'''</span><br></td>
                </tr>
            </tbody>
        </table>
        <br>
        <h3>Detalle de llamadas</h3>
        <table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
            <tbody>
                <tr>
                    <th style="vertical-align: top; text-align: center;">item<br></th>
                    <th style="vertical-align: top; text-align: center;">concepto</th>
                    <th style="vertical-align: top; text-align: center;">discado</th>
                    <th style="vertical-align: top; text-align: center;">destino</th>
                    <th style="vertical-align: top; text-align: center;">fecha</th>
                    <th style="vertical-align: top; text-align: center;">duracion</th>
                    <th style="vertical-align: top; text-align: center;">unidad</th>
                    <th style="vertical-align: top; text-align: center;">valor</th>
                    <th style="vertical-align: top; text-align: center;">sobrecargo</th>
                </tr>
''')
        for linea in VFFSL(SL,"detalle",True): # generated from line 55, col 17
            write(u'''                    <tr>
                        <td style="vertical-align: top; text-align: left;">''')
            _v = VFFSL(SL,"linea.item",True) # u'$linea.item' on line 57, col 76
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.item')) # from line 57, col 76.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: left;">''')
            _v = VFFSL(SL,"linea.concepto",True) # u'$linea.concepto' on line 58, col 76
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.concepto')) # from line 58, col 76.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: left;">''')
            _v = VFFSL(SL,"linea.discado",True) # u'$linea.discado' on line 59, col 76
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.discado')) # from line 59, col 76.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: left;">''')
            _v = VFFSL(SL,"linea.destino",True) # u'$linea.destino' on line 60, col 76
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.destino')) # from line 60, col 76.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: left;">''')
            _v = VFFSL(SL,"linea.fecha",True) # u'$linea.fecha' on line 61, col 76
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.fecha')) # from line 61, col 76.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: right;">''')
            _v = VFFSL(SL,"linea.duracion",True) # u'$linea.duracion' on line 62, col 77
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.duracion')) # from line 62, col 77.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: left;">''')
            _v = VFFSL(SL,"linea.unidad",True) # u'$linea.unidad' on line 63, col 76
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.unidad')) # from line 63, col 76.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: right;">''')
            _v = VFFSL(SL,"linea.valor",True) # u'$linea.valor' on line 64, col 77
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.valor')) # from line 64, col 77.
            write(u'''</td>
                        <td style="vertical-align: top; text-align: right;">''')
            _v = VFFSL(SL,"linea.sobrecargo",True) # u'$linea.sobrecargo' on line 65, col 77
            if _v is not None: write(_filter(_v, rawExpr=u'$linea.sobrecargo')) # from line 65, col 77.
            write(u'''</td>
                    </tr>
''')
        write(u'''            </tbody>
        </table>
    </body>
</html>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        
    ##################################################
    ## CHEETAH GENERATED ATTRIBUTES


    _CHEETAH__instanceInitialized = False

    _CHEETAH_version = __CHEETAH_version__

    _CHEETAH_versionTuple = __CHEETAH_versionTuple__

    _CHEETAH_genTime = __CHEETAH_genTime__

    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__

    _CHEETAH_src = __CHEETAH_src__

    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__

    _mainCheetahMethod_for_plantilla_cuenta= 'respond'

## END CLASS DEFINITION

if not hasattr(plantilla_cuenta, '_initCheetahAttributes'):
    templateAPIClass = getattr(plantilla_cuenta, '_CHEETAH_templateClass', Template)
    templateAPIClass._addCheetahPlumbingCodeToClass(plantilla_cuenta)


# CHEETAH was developed by Tavis Rudd and Mike Orr
# with code, advice and input from many other volunteers.
# For more information visit http://www.CheetahTemplate.org/

##################################################
## if run from command line:
if __name__ == '__main__':
    from Cheetah.TemplateCmdLineIface import CmdLineIface
    CmdLineIface(templateObj=plantilla_cuenta()).run()


